<template>
      <div>
		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-form class="title">
				<h2>预算调整单</h2>
				<el-form-item>
					<el-button @click="handleAdd" type="success">新建</el-button>
				</el-form-item>
			</el-form>
		</el-col>
		<!--列表-->
		<el-table 
            :data="budgetAdjustList" 
            highlight-current-row
            max-height="700" 
            v-loading="loading" 
            element-loading-text="正在加载中">
			<el-table-column prop="BA_DocNO" label="单号">
			</el-table-column>
			<el-table-column prop="Dept_Name" label="部门">
			</el-table-column>
			<el-table-column prop="UserName" label="编制人">
			</el-table-column>
			<el-table-column prop="BA_Abstract" label="标题">
			</el-table-column>
			<el-table-column prop="DocStatus" label="状态" sortable>
			</el-table-column>
			<el-table-column label="操作" min-width="200">
        <template slot-scope="scope">
					<el-button 
                                    size="small" 
                                    @click="handleEdit(scope.$index, scope.row)">&#12288;编辑&#12288;</el-button>
					<el-button 
                                    v-if="scope.row.DocStatus==='待审核'" 
                                    type="info" size="small" 
                                    @click="repeal(scope.$index, scope.row)">&#12288;撤销&#12288;</el-button>
					<el-button 
                                    type="warning" 
                                    size="small" 
                                    @click="checkflowRow(scope.$index, scope.row)">查看流程</el-button>
					<el-button 
                                    type="danger" 
                                    size="small" 
                                    @click="handleDel(scope.$index, scope.row)">&#12288;删除&#12288;</el-button>
                        </template>
			</el-table-column>
		</el-table>
		<!--流程图-->
		<el-dialog title="流程执行情况" :visible.sync="checkflowRowVisible" :modal-append-to-body="false" align="center">
			<el-table :data="docRowView" header-align="center" v-loading="docViewloading" element-loading-text="拼命刷新中...">
				<el-table-column property="PlanUser" label="操作人"></el-table-column>
				<el-table-column property="StepName" label="步骤名称"></el-table-column>
				<el-table-column property="OpDate" label="时间"></el-table-column>
				<el-table-column property="OpRemark" label="备注"></el-table-column>
			</el-table>
		</el-dialog>
	</div>
</template>
<script>
import axios from "../../../util/axios";
export default {
  data() {
    return {
      loading: false,
      budgetAdjustList: [], // 预算调整列表数据
      docRowView: [],
      docViewloading: false,
      checkflowRowVisible: false
    };
  },
  methods: {
    // 获取预算调整列表
    getList() {
      axios
        .get("getBudgetAdjustList", {
          page: 1, //一页
          rows: 5000 //显示5000条
        })
        .then(res => {
          this.loading = true;
          this.budgetAdjustList = res.rows;
          setTimeout(() => {
            this.loading = false;
          }, 500);
        });
    },

    handleAdd() {
      // 触发父组件的事件
      console.log(123)
      this.$emit("onAdd" , true);
    },

    handleEdit() {
      console.log("edit");
    },
    repeal() {},
    checkflowRow() {},
    handleDel() {}
  },
  mounted() {
    this.getList();
  }
};
</script>


<style scoped lang="scss">
@import "../../../common/css/index.css";
.toolbar h2 {
  margin: 10px auto 0 0;
}
.HideTable th {
  width: 16.6666%;
}
</style>